<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2018/8/6
  Time: 15:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <meta charset="UTF-8">
    <title>欢迎页面你哦</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>导航元素</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<xblock>
    <%--<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>--%>
    <button class="layui-btn" onclick="x_admin_show('添加用户','./AddIndexServlet',800,500)"><i class="layui-icon"></i>添加</button>
</xblock>
<table class="layui-table">
    <tr>

        <th>客户名字</th>
        <th>联系电话</th>
        <th>详细地址</th>
        <th>工单状态</th>
        <th>处理状态</th>
        <th>净水器名称</th>
        <th>订单id</th>
        <th>安装员Id</th>
        <th>安装员名字</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>
<c:forEach items="${list}" var="w">
    <c:forEach items="${w.proid}" var="p">
    <tr>

    <td>${w.userName}</td>
    <td>${w.userPhone}</td>
    <td>${w.userAddress}</td>
    <td><c:if test="${w.workType==1}">
        安装工单
    </c:if> <c:if test="${w.workType==2}">
        滤芯更换工单
    </c:if>
        <c:if test="${w.workType==3}">
            故障
        </c:if><c:if test="${w.workType==4}">
            移机
        </c:if>
    </td>
    <td><c:if test="${w.status==1}">
        待处理
    </c:if>
        <c:if test="${w.status==2}">
            处理中
        </c:if>
        <c:if test="${w.status==3}">
            已处理
        </c:if>
    </td>
        <td>${p.waterName}</td>

<script>

</script>

</c:forEach>
    <c:forEach items="${w.staid}" var="s">
        <c:forEach items="${s.uid}" var="u">
           <td name="workid">${w.workid}</td>
            <td>${w.staffid}</td>
            <td>${u.uname}</td>
            <td>${u.createTime}</td>
        </c:forEach>
    </c:forEach>
    <td class="td-status">

        <a title="新增"  href="javascript:;">
            <i class="layui-icon">&#xe642;</i>
        </a>
        
        <a onclick="x_admin_show('编辑','updServlet?workid=${w.workid}',800,500)" title="修改" href="javascript:;">
            <i class="layui-icon">&#xe631;</i>
        </a>
        <%--<a onclick="x_admin_show('删除','deleteServlet?workid=${w.workid}')" href="javascript:;">--%>
            <%--<i class="layui-icon">&#xe640;</i>--%>
        <%--</a>--%>
        <a title='删除'  href='javascript:;'><i class='layui-icon'>&#xe640;</i>
        </a>
    </td>
    </tr>
</c:forEach>

</table>
<div class="page">
    <div>
        <%--<a class="prev" href="">&lt;&lt;</a>--%>
        <%--<a class="num" href="">1</a>--%>
        <%--<span class="current">2</span>--%>
        <%--<a class="num" href="">3</a>--%>
        <%--<a class="num" href="">489</a>--%>
        <%--<a class="next" href="">&gt;&gt;</a>--%>
        <a href="IndexServlet?page=${page-1 }">上一页</a>
        <a href="IndexServlet?page=${page+1 }">下一页</a>
    </div>
</div>
<body>
<script>
    $(function () {
        $("[title=新增]").click(function () {
            x_admin_show('新增', 'AddIndexServlet', 800, 500);

        })
        var $tr;
        $("[title=删除]").click(function () {
            $tr = $(this).parent().parent();
            id = $tr.children().get(7).textContent;
            layer.confirm("确定要删除吗", function (idex) {
                if (idex > 0) {
                    $.post("deleteServlet", {"workid": id}, function (data) {
                        if (data > 0) {
                            $tr.remove();
                            layer.msg('删除成功', {icon: 1});
                        } else {
                            layer.msg('删除失败', {icon: 1});
                        }
                    })
                }
            })




        })

    })

</script>
<script>

    /*用户-停用*/
//    function member_stop(obj,id){
//        layer.confirm('确认故障吗？',function(index){
//
//            if($(obj).attr('title')=='故障'){
//
//                //发异步把用户状态进行更改
//                $(obj).attr('title','已故障')
//                $(obj).find('i').html('&#xe62f;');
//
//               $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('故障');
//               layer.msg('已故障!',{icon: 5,time:1000});//点击故障后
//
//            }else{
//                $(obj).attr('title','111')
//                $(obj).find('i').html('&#xe601;');
//
//                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已故障');
//                layer.msg('已故障!',{icon: 5,time:1000});
//            }
//
//        });
//    }


</script>
</body>
</html>
